def canIWin(maxChoosableInteger, desiredTotal):
    # 特殊情况处理
    if maxChoosableInteger * (maxChoosableInteger + 1) // 2 < desiredTotal:
        return False
    
    # 初始化dp表，大小为2^n，n是可选的最大整数
    dp = [None] * (1 << maxChoosableInteger)
    
    def dfs(state):
        # 检查是否已经计算过这个状态
        if dp[state] is not None:
            return dp[state]
        
        for i in range(maxChoosableInteger):
            mask = 1 << i
            if not state & mask:  # 如果这个数还没被用过
                if desiredTotal <= i + 1 or not dfs(state | mask):
                    dp[state] = True
                    return True
        dp[state] = False
        return False
    
    # 开始递归，初始状态为0（没有任何数字被选择）
    return dfs(0)

# 测试代码
if __name__ == "__main__":
    test_cases = [
        (10, 11, False),
        (10, 40, True),
        (1, 1, True),
        (2, 3, True),
        (3, 7, False),
        (4, 6, True),
        (15, 100, False)
    ]
    
    for i, (max_int, total, expected) in enumerate(test_cases):
        result = canIWin(max_int, total)
        print(f"测试用例 {i+1}: maxChoosableInteger={max_int}, desiredTotal={total} => 结果: {result}, {'通过' if result == expected else '失败'}")